<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .con {
            width: 210px;
            border: 1px solid #000;
            /*overflow: hidden;*/
        }

        .con div {
            width: 50px;
            height: 50px;
            margin: 10px;
            background-color: gold;
            float: left;
        }

        .clearfix:before,
        .clearfix:after {
            content: "";
            display: table;
        }

        .clearfix:after {
            clear: both;
        }

        .clearfix {
            zoom: 1;
        }

        .div5 {
            /*让元素 左边 不靠着浮动的元素  了解*/
            /*left right both*/
            /*clear: left;*/
        }
    </style>
</head>

<body>

    <div class="con clearfix">

        <div>1</div>
        <div>2</div>
        <div>3</div>
        <div>4</div>
        <div class="div5">5</div>
        <div>6</div>
        <div>7</div>
        <div>8</div>

    </div>



</body>

</html>